package com.transfiguro.datamodel.csmodels;

import com.transfiguro.datamodel.GenericStatement;
import com.transfiguro.datamodel.Statement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CSNCBlock extends GenericStatement{
    private final Logger logger = LoggerFactory.getLogger(CSNCBlock.class);
    private String statement;

    public CSNCBlock() {
        REQUIRE_CLOSING = false;
    }

    public boolean isRequireClosing() {
        return REQUIRE_CLOSING;
    }

    public String getStatement() {
        return statement;
    }

    public void setStatement(final String statement) {
        this.statement = statement;
    }

    @Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        if (statements != null) {
            for (final Statement statement : statements) {
                result.append('\t').append(statement.toString()).append(statement.isRequireClosing()? ';' : "");
            }
        }
        result.append((result.toString().equals("") && statement!=null)?'\t'+statement:"");
        //return statement!=null?'\n'+statement+'\n':"\n";
        return result.toString();
    }
}
